﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Twi.COMMON.HTTP;
using System.Xml.Linq;
using Twi.COMMON.WPF;

namespace Twi.COMMON.WPF
{
    public class BoolConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        { 
            if (parameter == null || value == null)
            {
                return false;
            }

            if (parameter.ToString().Split('-').Contains(string.Format("{0}", value)))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value.ToString().ToLower() == true.ToString().ToLower())
            {
                return parameter;
            }
            else
            {
                return 0;
            }
        }
    }
}
